package net.rlair.sbdemo.constant;

public enum SexEnum {

    MALE("男性", 1),
    FEMALE("女性", 2);

    private String name;

    private int value;
    SexEnum(final String name, final int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }

    public static SexEnum value2Enum(Integer value) {
        if (value == null) {
            return null;
        }
        for (SexEnum e : SexEnum.values()) {
            if (e.value == value) {
                return e;
            }
        }
        return null;
    }
}
